/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.dorian.atomicuml.orm;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedNativeQueries;
import javax.persistence.NamedNativeQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Ayden
 */
@Entity
@Table(name = "USERS_PROJECTS", schema="dorian")
@NamedNativeQueries({
    @NamedNativeQuery(name = "UsersProjects.findById", query = "SELECT * FROM users_projects u WHERE u.id = :id",  resultClass=UsersProjects.class),
    @NamedNativeQuery(name = "UsersProjects.findByProjectsIdAndUsersId",query = "SELECT * FROM users_projects u WHERE u.projects_id = :projects_id and u.users_id = :users_id",  resultClass=UsersProjects.class)})
public class UsersProjects implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "USERS_ID")
    private int usersId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "PROJECTS_ID")
    private int projectsId;

    public UsersProjects() {
    }

    public UsersProjects(Integer id) {
        this.id = id;
    }

    public UsersProjects(Integer id, int usersId, int projectsId) {
        this.id = id;
        this.usersId = usersId;
        this.projectsId = projectsId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getUsersId() {
        return usersId;
    }

    public void setUsersId(int usersId) {
        this.usersId = usersId;
    }

    public int getProjectsId() {
        return projectsId;
    }

    public void setProjectsId(int projectsId) {
        this.projectsId = projectsId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UsersProjects)) {
            return false;
        }
        UsersProjects other = (UsersProjects) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.dorian.atomicuml.orm.UsersProjects[ id=" + id + " ]";
    }
    
}
